package db4o;

import com.db4o.ObjectSet;

import pojo.User;

public class UserRemover extends DBManager {

	public void removeUser(String email) {
		ObjectSet<User> result = super.getDbManager().queryByExample(
				new User(null, null, null, email));
		super.getDbManager().delete(result.next());
	}

	public void removeAllUser() {
		UserRetriever ret = new UserRetriever();
		for (User u : ret.getAllUsers()) {
			super.getDbManager().delete(u);
		}
	}

//	public static void main(String[] args) {
//		UserRetriever ret = new UserRetriever();
//		User u = ret.fetchUser("frank1234@gmail.com");
//		System.out.println(u);
//		UserRemover rem = new UserRemover();
//		rem.removeUser("frank1234@gmail.com");
//		u = ret.fetchUser("frank1234@gmail.com");
//		if (u != null)
//			System.out.println(u);
//	}
}
